<?php
/*
 * This is gynecologist page.
 */
include '../../include/config.php';
$mid = mysql_fetch_array(mysql_query("select mother_id from baby_child_profile_detail where bid='" . $_COOKIE['bid'] . "'"));
$gynecinfo = mysql_query("select * from baby_mother_gynac where mother_id='" . $mid[0] . "' ");
$g = mysql_num_rows($gynecinfo);
if ($g == 0) {
    $avail = false;
} else {
    $avail = true;
}
?>
<script>
    $(function(){
        $('#dlg').click(function(){$('#dialog').dialog('open');return false;});
        $('#dlg2').click(function(){$('#dlgw').dialog('open');return false;});
        $('#dlgw').dialog({autoOpen : false});
        $("#dialog").dialog({
            autoOpen : false,
            modal : true,
            width : 'auto',
            height: 'auto',
            resizable : false,                       
            buttons: {
                "Save": function() {
                    $(this).find("form").submit();
                    $(this).dialog('close'); },
                "Don't Save": function() {
                    $(this).dialog("close");
                }
            }
        });
        $( "#datepicker1,#datepicker2" ).datepicker({
            showOn: "button",
            buttonImage: "../../include/images/calendar.gif",
            buttonImageOnly: true
        });
    });
</script>
<p>In addition to what usually happens during an annual gynecologic visit, good pre-pregnancy care deserves special consideration.  The period of time before you get pregnant is the best time to improve control of any chronic medical conditions you may have (high blood pressure, asthma).  A doctor should talk to you about any medications you may be taking which pose a potential risk to a developing fetus.</p>

<p>It’s a good idea to schedule a visit with your gynecologist to discuss the best way to prepare for a healthy pregnancy.</p>
<br/><br/><br/>
<fieldset>
    <legend>Personal Gynecologist Info.</legend>

    <?php if ($avail == false) { ?>
        You have not inserted your Psychologist info. Enter Information :<br>
        <form action="../pre_preg/save_gyn.php" method="post" >
            <table style="padding-left: 150px;" >
                <tr>
                    <td style="width: 150px;" >Dr. Name</td>
                    <td style="width: 200px;"><input type="text" name="g_doctor"/> </td>
                </tr>
                <tr>
                    <td>Address</td>
                    <td><input type="text" name="g_address" /> </td>
                </tr>
                <tr>
                    <td>City</td>
                    <td><input type="text" name="g_city" /></td>
                </tr>
                <tr>
                    <td>Country</td>
                    <td><input type="text" name="g_country" /></td>
                </tr>
                <tr>
                    <td>Telephone Nr.</td>
                    <td><input type="text" name="g_tel"/></td>
                </tr>
                <tr>
                    <td>Mobile Nr.</td>
                    <td><input type="text" name="g_mob" /></td>
                </tr>
                <tr>
                    <td>First visit</td>
                    <td><input type="text" name="g_first_visit"  id="datepicker1"  /></td>
                </tr>
                <tr>
                    <td>Visits</td>
                    <td>
                        <select name="g_visits" >
                            <option value="3" name="g_visits" >3</option>
                            <option value="4" name="g_visits">4</option>
                            <option value="5" name="g_visits">5</option>
                        </select> Weeks
                    </td>
                </tr>
                <tr>
                    <td>Last Visit</td>
                    <td><input type="text" name="g_last_visit"  id="datepicker2" /></td>
                </tr>
                <tr>
                    <td>
                        <input type="hidden" value="<?= $mid[0] ?>" name="mid" />
                        <input type="submit" value="Save Info" style="float: right;" />
                    </td>
                    <td></td>
                </tr>
            </table>

        </form>  
    <?php } ?>


    <?php if ($avail == true) { ?>

        <?php if ($_GET['p'] == 'view' || $_GET['p'] == '') { ?>
            <a href="pre-pregnancy.php?menu=gynecologist&p=edit" >UPDATE</a>
            <?php while ($row1 = mysql_fetch_array($gynecinfo)) { ?>                
                <table style="padding-left: 150px;" >
                    <tr>
                        <td style="width: 150px;" >Dr. Name</td>
                        <td style="width: 200px;"><?= $row1[2] ?> </td>
                    </tr>
                    <tr>
                        <td>Address</td>
                        <td><?= $row1[3] ?></td>
                    </tr>
                    <tr>
                        <td>City</td>
                        <td><?= $row1[4] ?></td>
                    </tr>
                    <tr>
                        <td>Country</td>
                        <td><?= $row1[5] ?></td>
                    </tr>
                    <tr>
                        <td>Telephone Nr.</td>
                        <td><?= $row1[6] ?></td>
                    </tr>
                    <tr>
                        <td>Mobile Nr.</td>
                        <td><?= $row1[7] ?></td>
                    </tr>
                    <tr>
                        <td>First visit (y-m-d)</td>
                        <td><?= $row1[8] ?></td>
                    </tr>
                    <tr>
                        <td>Visits</td>
                        <td><?= $row1[9] ?> Weeks</td>
                    </tr>
                    <tr>
                        <td>Last Visit (y-m-d)</td>
                        <td><?= $row1[10] ?></td>
                    </tr>                        
                    
                </table>

            <?php }
            ?>  
        <?php } elseif ($_GET['p'] == 'edit') {
            ?>


            <?php while ($row = mysql_fetch_array($gynecinfo)) { ?>
                <a href="pre-pregnancy.php?menu=gynecologist" >CANCLE</a>
                <form action="../pre_preg/edit.php" method="post" >
                    <table style="padding-left: 150px;" >
                        <tr>
                            <td style="width: 150px;" >Dr. Name</td>
                            <td style="width: 200px;"><input type="text" name="g_doctor" value="<?= $row[2] ?>" </td>
                        </tr>
                        <tr>
                            <td>Address</td>
                            <td><input type="text" name="g_address" value="<?= $row[3] ?>" </td>
                        </tr>
                        <tr>
                            <td>City</td>
                            <td><input type="text" name="g_city" value="<?= $row[4] ?>"</td>
                        </tr>
                        <tr>
                            <td>Country</td>
                            <td><input type="text" name="g_country" value="<?= $row[5] ?>"</td>
                        </tr>
                        <tr>
                            <td>Telephone Nr.</td>
                            <td><input type="text" name="g_tel" value="<?= $row[6] ?>"</td>
                        </tr>
                        <tr>
                            <td>Mobile Nr.</td>
                            <td><input type="text" name="g_mob" value="<?= $row[7] ?>"</td>
                        </tr>
                        <tr>
                            <td>First visit</td>
                            <td><input type="text" name="g_first_visit" value="<?= $row[8] ?>" id="datepicker1"  /></td>
                        </tr>
                        <tr>
                            <td>Visits</td>
                            <td><?= $row[9] ?> Weeks  <br/>
                                <select name="g_visits" >
                                    <option value="3"  >3</option>
                                    <option value="4">4</option>
                                    <option value="5">5</option>
                                </select> Weeks
                            </td>
                        </tr>
                        <tr>
                            <td>Last Visit</td>
                            <td><input type="text" name="g_last_visit" value="<?= $row[10] ?>" id="datepicker2" /></td>
                        </tr>
                        <tr>
                            <td>
                                <input type="hidden" value="<?= $mid[0] ?>" name="mid" />
                                <input type="submit" value="Edit" style="float: right;" />
                            </td>
                            <td></td>
                        </tr>
                    </table>

                </form>  
                <?php
            }
        }
        ?>      
    <?php } ?>    
</fieldset>
